package com.zero.xiaodai.utils;

import java.util.List;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.CellRangeAddress;

import com.google.common.base.Strings;

public class ExcelWriteHelper {
	
	public static HSSFWorkbook getHSSFWorkbook(String sheetName,String []title,String [][]values, HSSFWorkbook wb){

        // 第一步，创建一个HSSFWorkbook，对应一个Excel文件
        if(wb == null){
            wb = new HSSFWorkbook();
        }

        // 第二步，在workbook中添加一个sheet,对应Excel文件中的sheet
        HSSFSheet sheet = wb.createSheet(sheetName);
        sheet.autoSizeColumn(1, true);
        // 第三步，在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制
        HSSFRow row = sheet.createRow(0);

        // 第四步，创建单元格，并设置值表头 设置表头居中
        HSSFCellStyle style = wb.createCellStyle();
        style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式

        //声明列对象
        HSSFCell cell = null;

        //创建标题
        for(int i=0;i<title.length;i++){
            cell = row.createCell(i);
            cell.setCellValue(title[i]);
            cell.setCellStyle(style);
        }

        //创建内容
        for(int i=0;i<values.length;i++){
        	
            row = sheet.createRow(i + 1);
            for(int j=0;j<values[i].length;j++){
                //将内容按顺序赋给对应的列对象
            	if("null".equals(values[i][j])) {
            		values[i][j]="";
            	}
                row.createCell(j).setCellValue(values[i][j]);
            }
        }
        return wb;
    }
	
	
	
	
	public static HSSFWorkbook getHSSFWorkbooks(List<String> sheetNames,String []title,List<String [][]> valuesList, HSSFWorkbook wb){

        // 第一步，创建一个HSSFWorkbook，对应一个Excel文件
        if(wb == null){
            wb = new HSSFWorkbook();
        }
        int index=0;
        for(String sheetName:sheetNames) {
        	// 第二步，在workbook中添加一个sheet,对应Excel文件中的sheet
            HSSFSheet sheet = wb.createSheet(sheetName);
            sheet.autoSizeColumn(1, true);
            // 第三步，在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制
            HSSFRow row = sheet.createRow(0);

            // 第四步，创建单元格，并设置值表头 设置表头居中
            HSSFCellStyle style = wb.createCellStyle();
            style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式

            //声明列对象
            HSSFCell cell = null;

            //创建标题
            for(int i=0;i<title.length;i++){
                cell = row.createCell(i);
                cell.setCellValue(title[i]);
                cell.setCellStyle(style);
            }
            
            
            if(!ListUtil.isNullOrEmpty(valuesList)) {
            	String [][] values=valuesList.get(index);

                //创建内容
                for(int i=0;i<values.length;i++){
                	
                    row = sheet.createRow(i + 1);
                    for(int j=0;j<values[i].length;j++){
                        //将内容按顺序赋给对应的列对象
                    	if("null".equals(values[i][j])) {
                    		values[i][j]="";
                    	}
                        row.createCell(j).setCellValue(values[i][j]);
                    }
                }
            }
            index++;
        }

        
        return wb;
    }
	
	
	
	
	public static HSSFWorkbook getXsxzHSSFWorkbook(String sheetName,String []title,String [][]values, HSSFWorkbook wb){
		// 第一步，创建一个HSSFWorkbook，对应一个Excel文件
        if(wb == null){
            wb = new HSSFWorkbook();
        }
        //声明列对象
        HSSFCell cell = null;
        // 第二步，在workbook中添加一个sheet,对应Excel文件中的sheet
        HSSFSheet sheet = wb.createSheet(sheetName);
        sheet.autoSizeColumn(1, true);
        // 第三步，在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制
        HSSFRow row = sheet.createRow(0);

        // 第四步，创建单元格，并设置值表头 设置表头居中
        HSSFCellStyle style = wb.createCellStyle();
        style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
        style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
        
        
        HSSFCellStyle newStyle = wb.createCellStyle();
        newStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
        newStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
        newStyle.setRotation((short)255);
        
        
        CellRangeAddress callRangeAddress = new CellRangeAddress(0,0,0,24);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress);
        
        CellRangeAddress callRangeAddress1 = new CellRangeAddress(2,12,0,0);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress1);
        
        CellRangeAddress callRangeAddress2 = new CellRangeAddress(2,2,1,12);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress2);
        CellRangeAddress callRangeAddress3 = new CellRangeAddress(2,2,13,23);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress3);
        CellRangeAddress callRangeAddress4 = new CellRangeAddress(3,4,1,5);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress4);
        CellRangeAddress callRangeAddress5 = new CellRangeAddress(3,7,6,11);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress5);
        CellRangeAddress callRangeAddress6 = new CellRangeAddress(3,12,12,12);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress6);
        CellRangeAddress callRangeAddress7 = new CellRangeAddress(3,12,13,13);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress7);
        
        CellRangeAddress callRangeAddress8 = new CellRangeAddress(3,3,14,23);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress8);
        
        CellRangeAddress callRangeAddress9 = new CellRangeAddress(4,4,14,17);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress9);
        
        CellRangeAddress callRangeAddress10 = new CellRangeAddress(4,4,18,21);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress10);
        
        CellRangeAddress callRangeAddress11 = new CellRangeAddress(4,12,22,22);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress11);
        CellRangeAddress callRangeAddress12 = new CellRangeAddress(4,12,23,23);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress12);
        CellRangeAddress callRangeAddress131 = new CellRangeAddress(5,12,1,1);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress131);
        CellRangeAddress callRangeAddress13 = new CellRangeAddress(5,7,2,5);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress13);
        
        CellRangeAddress callRangeAddress14 = new CellRangeAddress(5,12,14,14);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress14);
        
        CellRangeAddress callRangeAddress15 = new CellRangeAddress(5,7,15,17);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress15);
        
        CellRangeAddress callRangeAddress16 = new CellRangeAddress(5,12,18,18);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress16);
        CellRangeAddress callRangeAddress17 = new CellRangeAddress(5,7,19,21);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress17);
        
        CellRangeAddress callRangeAddress18 = new CellRangeAddress(8,12,2,2);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress18);
        CellRangeAddress callRangeAddress19 = new CellRangeAddress(8,12,3,3);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress19);
        CellRangeAddress callRangeAddress20 = new CellRangeAddress(8,12,4,4);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress20);
        CellRangeAddress callRangeAddress21 = new CellRangeAddress(8,12,5,5);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress21);
        CellRangeAddress callRangeAddress22 = new CellRangeAddress(8,12,6,6);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress22);
        
        CellRangeAddress callRangeAddress23 = new CellRangeAddress(8,12,7,7);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress23);
        CellRangeAddress callRangeAddress24 = new CellRangeAddress(8,12,8,8);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress24);
        CellRangeAddress callRangeAddress25 = new CellRangeAddress(8,12,9,9);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress25);
        CellRangeAddress callRangeAddress26 = new CellRangeAddress(8,12,10,10);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress26);
        CellRangeAddress callRangeAddress27 = new CellRangeAddress(8,12,11,11);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress27);
        CellRangeAddress callRangeAddress28 = new CellRangeAddress(8,12,15,15);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress28);
        CellRangeAddress callRangeAddress29 = new CellRangeAddress(8,12,16,16);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress29);
        CellRangeAddress callRangeAddress30 = new CellRangeAddress(8,12,17,17);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress30);
        CellRangeAddress callRangeAddress31 = new CellRangeAddress(8,12,19,19);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress31);
        CellRangeAddress callRangeAddress32 = new CellRangeAddress(8,12,20,20);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress32);
        CellRangeAddress callRangeAddress33 = new CellRangeAddress(8,12,21,21);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress33);
        
        
        cell = row.createCell(0);
        cell.setCellValue("律师业务统计表(刑事、行政)");
        cell.setCellStyle(style);
        
        row = sheet.createRow(1);
        for(int i=0;i<31;i++){
            cell = row.createCell(i);
            cell.setCellValue("");
            cell.setCellStyle(style);
        }

        row = sheet.createRow(2);
        cell = row.createCell(0);
        cell.setCellValue("分类");
        cell.setCellStyle(style);
        
        cell = row.createCell(1);
        cell.setCellValue("刑事案件辩护及代理（不含法律援助）");
        cell.setCellStyle(style);
        
        cell = row.createCell(13);
        cell.setCellValue("行政案件（不含法律援助）");
        cell.setCellStyle(style);
        
        row = sheet.createRow(3);
        cell = row.createCell(1);
        cell.setCellValue("案件总量");
        cell.setCellStyle(style);
        
        cell = row.createCell(6);
        cell.setCellValue("代理阶段");
        cell.setCellStyle(style);
        
        cell = row.createCell(12);
        cell.setCellValue("刑事申诉、控告");
        cell.setCellStyle(newStyle);
        
        cell = row.createCell(13);
        cell.setCellValue("总计");
        cell.setCellStyle(newStyle);
        cell = row.createCell(14);
        cell.setCellValue("其中");
        cell.setCellStyle(style);
        
        
        row = sheet.createRow(4);
        cell = row.createCell(14);
        cell.setCellValue("行政诉讼代理");
        cell.setCellStyle(style);
        cell = row.createCell(18);
        cell.setCellValue("行政复议代理");
        cell.setCellStyle(style);
        cell = row.createCell(22);
        cell.setCellValue("行政申诉");
        cell.setCellStyle(newStyle);
        cell = row.createCell(23);
        cell.setCellValue("行政非诉执行");
        cell.setCellStyle(newStyle);
        

        row = sheet.createRow(5);
        cell = row.createCell(1);
        cell.setCellValue("合计");
        cell.setCellStyle(newStyle);
        cell = row.createCell(2);
        cell.setCellValue("其 中");
        cell.setCellStyle(style);
        cell = row.createCell(14);
        cell.setCellValue("合计");
        cell.setCellStyle(newStyle);
        cell = row.createCell(15);
        cell.setCellValue("其 中");
        cell.setCellStyle(style);
        cell = row.createCell(18);
        cell.setCellValue("合计");
        cell.setCellStyle(newStyle);
        cell = row.createCell(19);
        cell.setCellValue("其 中");
        cell.setCellStyle(style);
        
        row = sheet.createRow(8);
        cell = row.createCell(2);
        cell.setCellValue("公诉案件辩护");
        cell.setCellStyle(newStyle);

        cell = row.createCell(3);
        cell.setCellValue("自诉案件辩护");
        cell.setCellStyle(newStyle);

        cell = row.createCell(4);
        cell.setCellValue("被害人（自诉人）\r\n" + "代理");
        cell.setCellStyle(newStyle);

        cell = row.createCell(5);
        cell.setCellValue("刑事附带民事诉讼\r\n" + "代理");
        cell.setCellStyle(newStyle);

        cell = row.createCell(6);
        cell.setCellValue("侦查阶段");
        cell.setCellStyle(newStyle);
        cell = row.createCell(7);
        cell.setCellValue("审查起诉阶段");
        cell.setCellStyle(newStyle);
        cell = row.createCell(8);
        cell.setCellValue("一审阶段");
        cell.setCellStyle(newStyle);
        cell = row.createCell(9);
        cell.setCellValue("二审阶段");
        cell.setCellStyle(newStyle);
        cell = row.createCell(10);
        cell.setCellValue("死刑复核");
        cell.setCellStyle(newStyle);
        cell = row.createCell(11);
        cell.setCellValue("再审案件");
        cell.setCellStyle(newStyle);

        cell = row.createCell(15);
        cell.setCellValue("代理原告");
        cell.setCellStyle(newStyle);
        cell = row.createCell(16);
        cell.setCellValue("代理被告");
        cell.setCellStyle(newStyle);
        cell = row.createCell(17);
        cell.setCellValue("代理第三人");
        cell.setCellStyle(newStyle);
        cell = row.createCell(19);
        cell.setCellValue("代理复议申请人");
        cell.setCellStyle(newStyle);
        cell = row.createCell(20);
        cell.setCellValue("代理复议机关");
        cell.setCellStyle(newStyle);
        cell = row.createCell(21);
        cell.setCellValue("代理第三人");
        cell.setCellStyle(newStyle);
        

        row = sheet.createRow(13);
        //创建标题
        for(int i=0;i<title.length;i++){
            cell = row.createCell(i);
            String t="";
            if(i==0) {
            	t="甲";
            }else {
            	t=""+i;
            }
            cell.setCellValue(t);
            cell.setCellStyle(style);
        }

        //创建内容
        for(int i=0;i<values.length;i++){
        	
            row = sheet.createRow(i + 14);
            //row.createCell(0).setCellValue(s[i]);
            for(int j=0;j<values[i].length;j++){
                //将内容按顺序赋给对应的列对象
            	if(Strings.isNullOrEmpty(values[i][j])||values[i][j].equals("null")) {
            		continue;
            	}
                row.createCell(j).setCellValue(values[i][j]);
            }
        }
        
        
        return wb;
    }
	
	
	
	public static HSSFWorkbook getMsssHSSFWorkbook(String sheetName,String []title,String [][]values, HSSFWorkbook wb){
		// 第一步，创建一个HSSFWorkbook，对应一个Excel文件
        if(wb == null){
            wb = new HSSFWorkbook();
        }
        //声明列对象
        HSSFCell cell = null;
        // 第二步，在workbook中添加一个sheet,对应Excel文件中的sheet
        HSSFSheet sheet = wb.createSheet(sheetName);
        sheet.autoSizeColumn(1, true);
        // 第三步，在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制
        HSSFRow row = sheet.createRow(0);

        // 第四步，创建单元格，并设置值表头 设置表头居中
        HSSFCellStyle style = wb.createCellStyle();
        style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
        style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
        
        
        HSSFCellStyle newStyle = wb.createCellStyle();
        newStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
        newStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
        newStyle.setRotation((short)255);
        
        
        CellRangeAddress callRangeAddress = new CellRangeAddress(0,0,0,32);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress);
        CellRangeAddress callRangeAddress2 = new CellRangeAddress(2,8,0,0);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress2);
        CellRangeAddress callRangeAddress3 = new CellRangeAddress(2,2,1,24);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress3);
        CellRangeAddress callRangeAddress4 = new CellRangeAddress(2,2,25,28);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress4);
        CellRangeAddress callRangeAddress5 = new CellRangeAddress(2,2,29,31);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress5);
        CellRangeAddress callRangeAddress6 = new CellRangeAddress(3,8,1,1);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress6);
        CellRangeAddress callRangeAddress7 = new CellRangeAddress(3,4,2,6);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress7);
        CellRangeAddress callRangeAddress8 = new CellRangeAddress(3,8,7,7);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress8);
        CellRangeAddress callRangeAddress9 = new CellRangeAddress(3,8,8,8);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress9);
        CellRangeAddress callRangeAddress10 = new CellRangeAddress(3,8,9,9);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress10);
        CellRangeAddress callRangeAddress11 = new CellRangeAddress(3,8,10,10);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress11);
        CellRangeAddress callRangeAddress12 = new CellRangeAddress(3,8,11,11);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress12);
        CellRangeAddress callRangeAddress13 = new CellRangeAddress(3,8,12,12);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress13);
        CellRangeAddress callRangeAddress14 = new CellRangeAddress(3,8,13,13);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress14);
        CellRangeAddress callRangeAddress15 = new CellRangeAddress(3,8,14,14);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress15);
        CellRangeAddress callRangeAddress16 = new CellRangeAddress(3,8,15,15);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress16);
        CellRangeAddress callRangeAddress17 = new CellRangeAddress(3,8,16,16);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress17);
        CellRangeAddress callRangeAddress18 = new CellRangeAddress(3,8,17,17);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress18);
        CellRangeAddress callRangeAddress19 = new CellRangeAddress(3,8,18,18);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress19);
        CellRangeAddress callRangeAddress20 = new CellRangeAddress(3,8,19,19);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress20);
        CellRangeAddress callRangeAddress21 = new CellRangeAddress(3,8,20,20);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress21);
        CellRangeAddress callRangeAddress22 = new CellRangeAddress(3,8,21,21);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress22);
        CellRangeAddress callRangeAddress23 = new CellRangeAddress(3,8,22,22);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress23);
        CellRangeAddress callRangeAddress24 = new CellRangeAddress(3,8,23,23);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress24);
        CellRangeAddress callRangeAddress25 = new CellRangeAddress(3,8,24,24);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress25);
        CellRangeAddress callRangeAddress26 = new CellRangeAddress(3,8,25,25);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress26);
        CellRangeAddress callRangeAddress27 = new CellRangeAddress(3,4,26,28);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress27);
        CellRangeAddress callRangeAddress28 = new CellRangeAddress(3,8,29,29);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress28);
        CellRangeAddress callRangeAddress29 = new CellRangeAddress(3,4,30,31);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress29);
        
        CellRangeAddress callRangeAddress30 = new CellRangeAddress(5,8,2,2);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress30);
        CellRangeAddress callRangeAddress31 = new CellRangeAddress(5,6,3,5);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress31);
        CellRangeAddress callRangeAddress32 = new CellRangeAddress(5,8,6,6);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress32);
        CellRangeAddress callRangeAddress33 = new CellRangeAddress(5,8,26,26);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress33);
        CellRangeAddress callRangeAddress34 = new CellRangeAddress(5,8,27,27);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress34);
        CellRangeAddress callRangeAddress35 = new CellRangeAddress(5,8,28,28);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress35);
        CellRangeAddress callRangeAddress36 = new CellRangeAddress(5,8,30,30);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress36);
        CellRangeAddress callRangeAddress37 = new CellRangeAddress(5,8,31,31);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress37);
        CellRangeAddress callRangeAddress38 = new CellRangeAddress(7,8,3,3);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress38);
        CellRangeAddress callRangeAddress39 = new CellRangeAddress(7,8,4,4);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress39);
        CellRangeAddress callRangeAddress40 = new CellRangeAddress(7,8,5,5);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress40);
        
        cell = row.createCell(0);
        cell.setCellValue("律师业务统计表(民商事诉讼、仲裁、代书)");
        cell.setCellStyle(style);
        
        row = sheet.createRow(1);
        for(int i=0;i<31;i++){
            cell = row.createCell(i);
            cell.setCellValue("");
            cell.setCellStyle(style);
        }

        row = sheet.createRow(2);
        cell = row.createCell(0);
        cell.setCellValue("分类");
        cell.setCellStyle(style);
        
        cell = row.createCell(1);
        cell.setCellValue("民商事诉讼（不含法律援助）");
        cell.setCellStyle(style);
        
        cell = row.createCell(25);
        cell.setCellValue("仲裁业务");
        cell.setCellStyle(style);
        cell = row.createCell(29);
        cell.setCellValue("咨询代写法律文书");
        cell.setCellStyle(style);
        
        row = sheet.createRow(3);
        cell = row.createCell(1);
        cell.setCellValue("合计");
        cell.setCellStyle(style);
        
        cell = row.createCell(2);
        cell.setCellValue("企业破产案件");
        cell.setCellStyle(style);
        cell = row.createCell(7);
        cell.setCellValue("公司纠纷");
        cell.setCellStyle(newStyle);
        cell = row.createCell(8);
        cell.setCellValue("金融银行纠纷");
        cell.setCellStyle(newStyle);
        cell = row.createCell(9);
        cell.setCellValue("证券纠纷");
        cell.setCellStyle(newStyle);
        cell = row.createCell(10);
        cell.setCellValue("保险纠纷");
        cell.setCellStyle(newStyle);
        cell = row.createCell(11);
        cell.setCellValue("建筑房地产纠纷");
        cell.setCellStyle(newStyle);
        cell = row.createCell(12);
        cell.setCellValue("知识产权纠纷");
        cell.setCellStyle(newStyle);
        cell = row.createCell(13);
        cell.setCellValue("涉外与海事海商纠纷");
        cell.setCellStyle(newStyle);
        cell = row.createCell(14);
        cell.setCellValue("劳动争议与人事纠纷");
        cell.setCellStyle(newStyle);
        cell = row.createCell(15);
        cell.setCellValue("婚姻家庭纠纷");
        cell.setCellStyle(newStyle);
        cell = row.createCell(16);
        cell.setCellValue("继承纠纷");
        cell.setCellStyle(newStyle);
        cell = row.createCell(17);
        cell.setCellValue("交通事故纠纷");
        cell.setCellStyle(newStyle);
        cell = row.createCell(18);
        cell.setCellValue("医疗事故纠纷");
        cell.setCellStyle(newStyle);
        cell = row.createCell(19);
        cell.setCellValue("环境保护纠纷");
        cell.setCellStyle(newStyle);
        cell = row.createCell(20);
        cell.setCellValue("物权纠纷");
        cell.setCellStyle(newStyle);
        cell = row.createCell(21);
        cell.setCellValue("其他民商事纠纷");
        cell.setCellStyle(newStyle);
        cell = row.createCell(22);
        cell.setCellValue("国家赔偿案件");
        cell.setCellStyle(newStyle);
        cell = row.createCell(23);
        cell.setCellValue("民事申诉");
        cell.setCellStyle(newStyle);
        cell = row.createCell(24);
        cell.setCellValue("民商事执行案件");
        cell.setCellStyle(newStyle);
        cell = row.createCell(25);
        cell.setCellValue("合计");
        cell.setCellStyle(newStyle);
        cell = row.createCell(26);
        cell.setCellValue("其中");
        cell.setCellStyle(style);

        cell = row.createCell(29);
        cell.setCellValue("合计");
        cell.setCellStyle(newStyle);
        cell = row.createCell(30);
        cell.setCellValue("其中");
        cell.setCellStyle(style);

        row = sheet.createRow(5);
        cell = row.createCell(2);
        cell.setCellValue("破产案件合计");
        cell.setCellStyle(newStyle);
        cell = row.createCell(3);
        cell.setCellValue("其中");
        cell.setCellStyle(style);
        cell = row.createCell(6);
        cell.setCellValue("其中担任\r\n" + "破产管理人");
        cell.setCellStyle(newStyle);
        cell = row.createCell(26);
        cell.setCellValue("国内商事仲裁");
        cell.setCellStyle(newStyle);
        cell = row.createCell(27);
        cell.setCellValue("劳动争议仲裁");
        cell.setCellStyle(newStyle);
        cell = row.createCell(28);
        cell.setCellValue("国际商事仲裁");
        cell.setCellStyle(newStyle);
        cell = row.createCell(30);
        cell.setCellValue("法律咨询");
        cell.setCellStyle(newStyle);
        cell = row.createCell(31);
        cell.setCellValue("代写法律文书");
        cell.setCellStyle(newStyle);
        

        row = sheet.createRow(7);
        cell = row.createCell(3);
        cell.setCellValue("破产和解");
        cell.setCellStyle(newStyle);
        cell = row.createCell(4);
        cell.setCellValue("破产重整");
        cell.setCellStyle(newStyle);
        cell = row.createCell(5);
        cell.setCellValue("破产清算");
        cell.setCellStyle(newStyle);

        row = sheet.createRow(9);
        //创建标题
        for(int i=0;i<title.length;i++){
            cell = row.createCell(i);
            String t="";
            if(i==0) {
            	t="甲";
            }else {
            	t=""+i;
            }
            cell.setCellValue(t);
            cell.setCellStyle(style);
        }

        //创建内容
        for(int i=0;i<values.length;i++){
        	
            row = sheet.createRow(i + 10);
            //row.createCell(0).setCellValue(s[i]);
            for(int j=0;j<values[i].length;j++){
                //将内容按顺序赋给对应的列对象
            	if(Strings.isNullOrEmpty(values[i][j])||values[i][j].equals("null")) {
            		continue;
            	}
                row.createCell(j).setCellValue(values[i][j]);
            }
        }
        
        
        return wb;
    }
	
	
	
	

	public static HSSFWorkbook getFlgwHSSFWorkbook(String sheetName,String []title,String [][]values, HSSFWorkbook wb){

		String []s =new String[]{"法律顾问数\n（家）","年度收费累计\n（万元）"};
        // 第一步，创建一个HSSFWorkbook，对应一个Excel文件
        if(wb == null){
            wb = new HSSFWorkbook();
        }
        //声明列对象
        HSSFCell cell = null;
        // 第二步，在workbook中添加一个sheet,对应Excel文件中的sheet
        HSSFSheet sheet = wb.createSheet(sheetName);
        sheet.autoSizeColumn(1, true);
        // 第三步，在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制
        HSSFRow row = sheet.createRow(0);

        // 第四步，创建单元格，并设置值表头 设置表头居中
        HSSFCellStyle style = wb.createCellStyle();
        style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
        style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
        
        
        HSSFCellStyle newStyle = wb.createCellStyle();
        newStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
        newStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
        newStyle.setRotation((short)255);
        
        
        CellRangeAddress callRangeAddress = new CellRangeAddress(0,0,0,30);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress);
        CellRangeAddress callRangeAddress1 = new CellRangeAddress(2,9,0,0);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress1);
        CellRangeAddress callRangeAddress2 = new CellRangeAddress(2,9,1,1);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress2);
        CellRangeAddress callRangeAddress3 = new CellRangeAddress(2,2,2,16);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress3);
        
        CellRangeAddress callRangeAddress4 = new CellRangeAddress(2,9,17,17);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress4);
        CellRangeAddress callRangeAddress5 = new CellRangeAddress(2,9,18,18);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress5);
        CellRangeAddress callRangeAddress6 = new CellRangeAddress(2,9,19,19);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress6);
        CellRangeAddress callRangeAddress7 = new CellRangeAddress(2,2,20,23);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress7);
        CellRangeAddress callRangeAddress8 = new CellRangeAddress(2,2,24,27);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress8);
        
        CellRangeAddress callRangeAddress9 = new CellRangeAddress(2,9,28,28);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress9);
        CellRangeAddress callRangeAddress10 = new CellRangeAddress(2,9,29,29);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress10);
        CellRangeAddress callRangeAddress11 = new CellRangeAddress(2,9,30,30);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress11);
        CellRangeAddress callRangeAddress12 = new CellRangeAddress(3,9,2,2);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress12);
        CellRangeAddress callRangeAddress13 = new CellRangeAddress(3,4,3,10);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress13);
        CellRangeAddress callRangeAddress14 = new CellRangeAddress(3,4,11,16);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress14);
        CellRangeAddress callRangeAddress141 = new CellRangeAddress(3,9,20,20);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress141);
        CellRangeAddress callRangeAddress142 = new CellRangeAddress(3,9,21,21);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress142);
        CellRangeAddress callRangeAddress143 = new CellRangeAddress(3,9,22,22);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress143);
        CellRangeAddress callRangeAddress144 = new CellRangeAddress(3,9,23,23);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress144);
        CellRangeAddress callRangeAddress145 = new CellRangeAddress(3,9,24,24);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress145);
        CellRangeAddress callRangeAddress146 = new CellRangeAddress(3,9,25,25);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress146);
        CellRangeAddress callRangeAddress147 = new CellRangeAddress(3,9,26,26);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress147);
        CellRangeAddress callRangeAddress148 = new CellRangeAddress(3,9,27,27);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress148);
        CellRangeAddress callRangeAddress15 = new CellRangeAddress(5,6,3,5);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress15);
        CellRangeAddress callRangeAddress16 = new CellRangeAddress(5,6,6,9);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress16);
        CellRangeAddress callRangeAddress17 = new CellRangeAddress(5,9,10,10);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress17);
        CellRangeAddress callRangeAddress181 = new CellRangeAddress(5,6,11,12);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress181);
        CellRangeAddress callRangeAddress18 = new CellRangeAddress(5,6,13,15);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress18);
        
        CellRangeAddress callRangeAddress19 = new CellRangeAddress(5,9,16,16);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress19);
        CellRangeAddress callRangeAddress20 = new CellRangeAddress(5,9,20,20);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress20);
        CellRangeAddress callRangeAddress21 = new CellRangeAddress(5,9,21,21);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress21);
        CellRangeAddress callRangeAddress22 = new CellRangeAddress(5,9,22,22);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress22);
        CellRangeAddress callRangeAddress23 = new CellRangeAddress(5,9,23,23);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress23);
        CellRangeAddress callRangeAddress24 = new CellRangeAddress(5,9,24,24);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress24);
        CellRangeAddress callRangeAddress25 = new CellRangeAddress(5,9,25,25);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress25);
        CellRangeAddress callRangeAddress26 = new CellRangeAddress(5,9,26,26);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress26);
        CellRangeAddress callRangeAddress27 = new CellRangeAddress(5,9,27,27);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress27);
        CellRangeAddress callRangeAddress28 = new CellRangeAddress(7,9,3,3);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress28);
        CellRangeAddress callRangeAddress29 = new CellRangeAddress(7,9,4,4);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress29);
        CellRangeAddress callRangeAddress30 = new CellRangeAddress(7,9,5,5);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress30);
        CellRangeAddress callRangeAddress31 = new CellRangeAddress(7,9,6,6);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress31);
        CellRangeAddress callRangeAddress32 = new CellRangeAddress(7,9,7,7);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress32);
        CellRangeAddress callRangeAddress33 = new CellRangeAddress(7,9,8,8);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress33);
        CellRangeAddress callRangeAddress34 = new CellRangeAddress(7,9,9,9);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress34);
        CellRangeAddress callRangeAddress35 = new CellRangeAddress(7,9,11,11);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress35);
        CellRangeAddress callRangeAddress36 = new CellRangeAddress(7,9,12,12);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress36);
        CellRangeAddress callRangeAddress37 = new CellRangeAddress(7,9,13,13);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress37);
        CellRangeAddress callRangeAddress38 = new CellRangeAddress(7,9,14,14);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress38);
        CellRangeAddress callRangeAddress39 = new CellRangeAddress(7,9,15,15);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress39);
        cell = row.createCell(0);
        cell.setCellValue("律师业务统计表(法律顾问)");
        cell.setCellStyle(style);
        row = sheet.createRow(1);
        for(int i=0;i<31;i++){
            cell = row.createCell(i);
            cell.setCellValue("");
            cell.setCellStyle(style);
        }

        row = sheet.createRow(2);
        cell = row.createCell(0);
        cell.setCellValue("分类");
        cell.setCellStyle(style);
        
        cell = row.createCell(1);
        cell.setCellValue("总计");
        cell.setCellStyle(style);
        
        cell = row.createCell(2);
        cell.setCellValue("党政机关法律顾问");
        cell.setCellStyle(style);
        
        cell = row.createCell(17);
        cell.setCellValue("人民团体法律顾问");
        cell.setCellStyle(newStyle);
        
        cell = row.createCell(18);
        cell.setCellValue("人大及人大部门法律顾问");
        cell.setCellStyle(newStyle);
        
        cell = row.createCell(19);
        cell.setCellValue("政协及政协部门法律顾问");
        cell.setCellStyle(newStyle);
        
        cell = row.createCell(20);
        cell.setCellValue("企业法律顾问");
        cell.setCellStyle(style);

        cell = row.createCell(24);
        cell.setCellValue("社会团体（组织）法律顾问");
        cell.setCellStyle(style);
        
        cell = row.createCell(28);
        cell.setCellValue("事业单位法律顾问");
        cell.setCellStyle(newStyle);
        
        cell = row.createCell(29);
        cell.setCellValue("公民个人法律顾问");
        cell.setCellStyle(newStyle);
        
        cell = row.createCell(30);
        cell.setCellValue("其他法律顾问");
        cell.setCellStyle(newStyle);

        
        row = sheet.createRow(3);
        cell = row.createCell(2);
        cell.setCellValue("合计");
        cell.setCellStyle(newStyle);

        cell = row.createCell(2);
        cell.setCellValue("合计");
        cell.setCellStyle(newStyle);

        cell = row.createCell(3);
        cell.setCellValue("政府法律顾问");
        cell.setCellStyle(style);
        cell = row.createCell(11);
        cell.setCellValue("党委法律顾问");
        cell.setCellStyle(style);
        cell = row.createCell(20);
        cell.setCellValue("合计");
        cell.setCellStyle(newStyle);

        cell = row.createCell(21);
        cell.setCellValue("规模以上企业顾问");
        cell.setCellStyle(newStyle);
        cell = row.createCell(22);
        cell.setCellValue("中小微企业法律顾问");
        cell.setCellStyle(newStyle);
        cell = row.createCell(23);
        cell.setCellValue("个体商户法律顾问");
        cell.setCellStyle(newStyle);
        cell = row.createCell(24);
        cell.setCellValue("合计");
        cell.setCellStyle(newStyle);
        cell = row.createCell(25);
        cell.setCellValue("商会顾问");
        cell.setCellStyle(newStyle);
        cell = row.createCell(26);
        cell.setCellValue("行业协会顾问");
        cell.setCellStyle(newStyle);
        cell = row.createCell(27);
        cell.setCellValue("其他社团组织顾问");
        cell.setCellStyle(newStyle);
        
        row = sheet.createRow(5);
        cell = row.createCell(3);
        cell.setCellValue("政府顾问");
        cell.setCellStyle(style);

        cell = row.createCell(6);
        cell.setCellValue("政府部门顾问");
        cell.setCellStyle(style);
        cell = row.createCell(10);
        cell.setCellValue("县级以上政府领导顾问");
        cell.setCellStyle(newStyle);
        

        cell = row.createCell(11);
        cell.setCellValue("党委顾问");
        cell.setCellStyle(style);
        

        cell = row.createCell(13);
        cell.setCellValue("党委部门顾问");
        cell.setCellStyle(style);
        cell = row.createCell(16);
        cell.setCellValue("县级以上党委领导顾问");
        cell.setCellStyle(newStyle);
        
        row = sheet.createRow(7);
        cell = row.createCell(3);
        cell.setCellValue("省市县政府顾问");
        cell.setCellStyle(newStyle);

        cell = row.createCell(4);
        cell.setCellValue("乡镇政府顾问");
        cell.setCellStyle(newStyle);

        cell = row.createCell(5);
        cell.setCellValue("街道办事处顾问");
        cell.setCellStyle(newStyle);
        
        cell.setCellStyle(newStyle);
        cell = row.createCell(6);
        cell.setCellValue("国家部委顾问");
        cell.setCellStyle(newStyle);
        cell = row.createCell(7);
        cell.setCellValue("省级政府部门顾问");
        cell.setCellStyle(newStyle);
        cell = row.createCell(8);
        cell.setCellValue("市级政府部门顾问");
        cell.setCellStyle(newStyle);

        cell = row.createCell(9);
        cell.setCellValue("县级政府部门顾问");
        cell.setCellStyle(newStyle);

        cell = row.createCell(11);
        cell.setCellValue("省市县党委顾问");
        cell.setCellStyle(newStyle);
        cell = row.createCell(12);
        cell.setCellValue("乡镇（街道）\r\n" +"党委顾问");
        cell.setCellStyle(newStyle);
        cell = row.createCell(13);
        cell.setCellValue("省级党委部门顾问");
        cell.setCellStyle(newStyle);
        cell = row.createCell(14);
        cell.setCellValue("市级党委部门顾问");
        cell.setCellStyle(newStyle);
        cell = row.createCell(15);
        cell.setCellValue("县级党委部门顾问");
        cell.setCellStyle(newStyle);


        row = sheet.createRow(10);
        //创建标题
        for(int i=0;i<title.length;i++){
            cell = row.createCell(i);
            String t="";
            if(i==0) {
            	t="甲";
            }else {
            	t=""+i;
            }
            cell.setCellValue(t);
            cell.setCellStyle(style);
        }

        //创建内容
        for(int i=0;i<values.length;i++){
        	
            row = sheet.createRow(i + 11);
            //row.createCell(0).setCellValue(s[i]);
            for(int j=0;j<values[i].length;j++){
                //将内容按顺序赋给对应的列对象
            	if(Strings.isNullOrEmpty(values[i][j])||values[i][j].equals("null")) {
            		continue;
            	}
                row.createCell(j).setCellValue(values[i][j]);
            }
        }
        
        
        return wb;
    }
	
	
	public static HSSFWorkbook getFsywHSSFWorkbook(String sheetName,String []title,String [][]values, HSSFWorkbook wb){

		// 第一步，创建一个HSSFWorkbook，对应一个Excel文件
        if(wb == null){
            wb = new HSSFWorkbook();
        }
        //声明列对象
        HSSFCell cell = null;
        // 第二步，在workbook中添加一个sheet,对应Excel文件中的sheet
        HSSFSheet sheet = wb.createSheet(sheetName);
        sheet.autoSizeColumn(1, true);
        // 第三步，在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制
        HSSFRow row = sheet.createRow(0);

        // 第四步，创建单元格，并设置值表头 设置表头居中
        HSSFCellStyle style = wb.createCellStyle();
        style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
        style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
        
        
        HSSFCellStyle newStyle = wb.createCellStyle();
        newStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
        newStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
        newStyle.setRotation((short)255);
        
        
        CellRangeAddress callRangeAddress = new CellRangeAddress(0,0,0,41);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress);
        CellRangeAddress callRangeAddress1 = new CellRangeAddress(2,9,0,0);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress1);
        CellRangeAddress callRangeAddress2 = new CellRangeAddress(2,9,1,1);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress2);
        CellRangeAddress callRangeAddress3 = new CellRangeAddress(2,3,2,31);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress3);
        
        CellRangeAddress callRangeAddress4 = new CellRangeAddress(2,3,32,41);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress4);
        CellRangeAddress callRangeAddress5 = new CellRangeAddress(4,9,2,2);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress5);
        CellRangeAddress callRangeAddress6 = new CellRangeAddress(4,9,3,3);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress6);
        CellRangeAddress callRangeAddress7 = new CellRangeAddress(4,9,4,4);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress7);
        CellRangeAddress callRangeAddress8 = new CellRangeAddress(4,9,5,5);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress8);
        
        CellRangeAddress callRangeAddress9 = new CellRangeAddress(4,4,6,11);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress9);
        CellRangeAddress callRangeAddress10 = new CellRangeAddress(4,9,12,12);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress10);
        CellRangeAddress callRangeAddress11 = new CellRangeAddress(4,4,13,17);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress11);
        CellRangeAddress callRangeAddress12 = new CellRangeAddress(4,9,18,18);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress12);
        CellRangeAddress callRangeAddress13 = new CellRangeAddress(4,9,19,19);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress13);
        CellRangeAddress callRangeAddress14 = new CellRangeAddress(4,9,20,20);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress14);
        CellRangeAddress callRangeAddress15 = new CellRangeAddress(4,9,21,21);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress15);
        CellRangeAddress callRangeAddress16 = new CellRangeAddress(4,9,22,22);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress16);
        CellRangeAddress callRangeAddress17 = new CellRangeAddress(4,9,23,23);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress17);
        
        CellRangeAddress callRangeAddress18 = new CellRangeAddress(4,9,24,24);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress18);
        
        CellRangeAddress callRangeAddress19 = new CellRangeAddress(4,9,25,25);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress19);
        CellRangeAddress callRangeAddress20 = new CellRangeAddress(4,4,26,29);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress20);
        CellRangeAddress callRangeAddress21 = new CellRangeAddress(4,9,30,30);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress21);
        CellRangeAddress callRangeAddress22 = new CellRangeAddress(4,9,31,31);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress22);
        CellRangeAddress callRangeAddress23 = new CellRangeAddress(4,9,32,32);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress23);
        CellRangeAddress callRangeAddress24 = new CellRangeAddress(4,4,33,37);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress24);
        CellRangeAddress callRangeAddress25 = new CellRangeAddress(4,4,38,40);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress25);
        CellRangeAddress callRangeAddress26 = new CellRangeAddress(4,9,41,41);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress26);
        CellRangeAddress callRangeAddress27 = new CellRangeAddress(5,9,6,6);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress27);
        CellRangeAddress callRangeAddress28 = new CellRangeAddress(5,9,7,7);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress28);
        CellRangeAddress callRangeAddress29 = new CellRangeAddress(5,9,8,8);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress29);
        CellRangeAddress callRangeAddress30 = new CellRangeAddress(5,9,9,9);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress30);
        CellRangeAddress callRangeAddress31 = new CellRangeAddress(5,9,10,10);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress31);
        CellRangeAddress callRangeAddress32 = new CellRangeAddress(5,9,11,11);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress32);
        CellRangeAddress callRangeAddress33 = new CellRangeAddress(5,9,13,13);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress33);
        CellRangeAddress callRangeAddress34 = new CellRangeAddress(5,9,14,14);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress34);
        CellRangeAddress callRangeAddress35 = new CellRangeAddress(5,9,15,15);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress35);
        CellRangeAddress callRangeAddress36 = new CellRangeAddress(5,9,16,16);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress36);
        CellRangeAddress callRangeAddress37 = new CellRangeAddress(5,9,17,17);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress37);
        CellRangeAddress callRangeAddress38 = new CellRangeAddress(5,9,26,26);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress38);
        CellRangeAddress callRangeAddress39 = new CellRangeAddress(5,9,27,27);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress39);
        CellRangeAddress callRangeAddress40 = new CellRangeAddress(5,9,28,28);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress40);
        CellRangeAddress callRangeAddress41 = new CellRangeAddress(5,9,29,29);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress41);
        CellRangeAddress callRangeAddress42 = new CellRangeAddress(5,9,33,33);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress42);
        CellRangeAddress callRangeAddress43 = new CellRangeAddress(5,9,34,34);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress43);
        CellRangeAddress callRangeAddress44 = new CellRangeAddress(5,9,35,35);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress44);
        CellRangeAddress callRangeAddress45 = new CellRangeAddress(5,9,36,36);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress45);
        CellRangeAddress callRangeAddress46 = new CellRangeAddress(5,9,37,37);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress46);
        CellRangeAddress callRangeAddress47 = new CellRangeAddress(5,9,38,38);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress47);
        CellRangeAddress callRangeAddress48 = new CellRangeAddress(5,9,39,39);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress48);
        CellRangeAddress callRangeAddress49 = new CellRangeAddress(5,9,40,40);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress49);
        cell = row.createCell(0);
        cell.setCellValue("律师业务统计表(非诉讼法律事务、涉外服务)");
        cell.setCellStyle(style);
        row = sheet.createRow(1);
        for(int i=0;i<31;i++){
            cell = row.createCell(i);
            cell.setCellValue("");
            cell.setCellStyle(style);
        }

        row = sheet.createRow(2);
        cell = row.createCell(0);
        cell.setCellValue("分类");
        cell.setCellStyle(style);
        
        cell = row.createCell(1);
        cell.setCellValue("合计");
        cell.setCellStyle(style);
        
        cell = row.createCell(2);
        cell.setCellValue("非诉讼法律事务（不含法律援助）");
        cell.setCellStyle(style);
        
        cell = row.createCell(32);
        cell.setCellValue("涉外法律服务");
        cell.setCellStyle(style);
        
        row = sheet.createRow(4);

        cell = row.createCell(2);
        cell.setCellValue("知识产权");
        cell.setCellStyle(newStyle);
        cell = row.createCell(3);
        cell.setCellValue("房地产");
        cell.setCellStyle(newStyle);
        cell = row.createCell(4);
        cell.setCellValue("公司业务");
        cell.setCellStyle(newStyle);
        cell = row.createCell(5);
        cell.setCellValue("金融业务");
        cell.setCellStyle(newStyle);
        cell = row.createCell(6);
        cell.setCellValue("其 中");
        cell.setCellStyle(style);
        cell = row.createCell(12);
        cell.setCellValue("证券业务");
        cell.setCellStyle(newStyle);
        cell = row.createCell(13);
        cell.setCellValue("其 中");
        cell.setCellStyle(style);
        cell = row.createCell(18);
        cell.setCellValue("期货业务");
        cell.setCellStyle(newStyle);
        cell = row.createCell(19);
        cell.setCellValue("保险业务");
        cell.setCellStyle(newStyle);
        cell = row.createCell(20);
        cell.setCellValue("税务");
        cell.setCellStyle(newStyle);
        cell = row.createCell(21);
        cell.setCellValue("反垄断");
        cell.setCellStyle(newStyle);
        cell = row.createCell(22);
        cell.setCellValue("劳动法");
        cell.setCellStyle(newStyle);
        cell = row.createCell(23);
        cell.setCellValue("海事海商");
        cell.setCellStyle(newStyle);
        cell = row.createCell(24);
        cell.setCellValue("环境资源与能源");
        cell.setCellStyle(newStyle);
        cell = row.createCell(25);
        cell.setCellValue("重大建设项目合计");
        cell.setCellStyle(newStyle);
        cell = row.createCell(26);
        cell.setCellValue("其中");
        cell.setCellStyle(style);
        cell = row.createCell(30);
        cell.setCellValue("国家赔偿纠纷");
        cell.setCellStyle(newStyle);
        cell = row.createCell(31);
        cell.setCellValue("其他非诉讼事务");
        cell.setCellStyle(newStyle);
        cell = row.createCell(32);
        cell.setCellValue("合计");
        cell.setCellStyle(newStyle);
        cell = row.createCell(33);
        cell.setCellValue("业务类型");
        cell.setCellStyle(style);
        cell = row.createCell(38);
        cell.setCellValue("客户种类（家）");
        cell.setCellStyle(style);
        cell = row.createCell(41);
        cell.setCellValue("收入额");
        cell.setCellStyle(newStyle);
        

        row = sheet.createRow(5);
        cell = row.createCell(6);
        cell.setCellValue("政府融资项目");
        cell.setCellStyle(newStyle);
        cell = row.createCell(7);
        cell.setCellValue("企业融资项目");
        cell.setCellStyle(newStyle);
        cell = row.createCell(8);
        cell.setCellValue("股权交易");
        cell.setCellStyle(newStyle);
        cell = row.createCell(9);
        cell.setCellValue("信托");
        cell.setCellStyle(newStyle);
        cell = row.createCell(10);
        cell.setCellValue("发行债券");
        cell.setCellStyle(newStyle);
        cell = row.createCell(11);
        cell.setCellValue("其他");
        cell.setCellStyle(newStyle);
        

        cell = row.createCell(13);
        cell.setCellValue("上市辅导、改制或首发");
        cell.setCellStyle(newStyle);
        cell = row.createCell(14);
        cell.setCellValue("上市公司增发");
        cell.setCellStyle(newStyle);
        cell = row.createCell(15);
        cell.setCellValue("上市公司并购");
        cell.setCellStyle(newStyle);
        cell = row.createCell(16);
        cell.setCellValue("新三板业务");
        cell.setCellStyle(newStyle);
        cell = row.createCell(17);
        cell.setCellValue("其他");
        cell.setCellStyle(newStyle);
        

        cell = row.createCell(26);
        cell.setCellValue("国家级重点项目");
        cell.setCellStyle(newStyle);
        cell = row.createCell(27);
        cell.setCellValue("省级重点项目");
        cell.setCellStyle(newStyle);
        cell = row.createCell(28);
        cell.setCellValue("市级重点项目");
        cell.setCellStyle(newStyle);
        cell = row.createCell(29);
        cell.setCellValue("县级重点项目");
        cell.setCellStyle(newStyle);
        

        cell = row.createCell(33);
        cell.setCellValue("跨境投资并购");
        cell.setCellStyle(newStyle);
        cell = row.createCell(34);
        cell.setCellValue("知识产权");
        cell.setCellStyle(newStyle);
        cell = row.createCell(35);
        cell.setCellValue("两反一保");
        cell.setCellStyle(newStyle);
        

        cell = row.createCell(36);
        cell.setCellValue("在境外参与诉讼、仲裁");
        cell.setCellStyle(newStyle);
        cell = row.createCell(37);
        cell.setCellValue("其他");
        cell.setCellStyle(newStyle);
        cell = row.createCell(38);
        cell.setCellValue("中国国有企业");
        cell.setCellStyle(newStyle);
        cell = row.createCell(39);
        cell.setCellValue("中国民营企业");
        cell.setCellStyle(newStyle);
        cell = row.createCell(40);
        cell.setCellValue("其他");
        cell.setCellStyle(newStyle);

        row = sheet.createRow(10);
        //创建标题
        for(int i=0;i<title.length;i++){
            cell = row.createCell(i);
            String t="";
            if(i==0) {
            	t="甲";
            }else {
            	t=""+i;
            }
            cell.setCellValue(t);
            cell.setCellStyle(style);
        }

        //创建内容
        for(int i=0;i<values.length;i++){
        	
            row = sheet.createRow(i + 11);
            //row.createCell(0).setCellValue(s[i]);
            for(int j=0;j<values[i].length;j++){
                //将内容按顺序赋给对应的列对象
            	if(Strings.isNullOrEmpty(values[i][j])||values[i][j].equals("null")) {
            		continue;
            	}
                row.createCell(j).setCellValue(values[i][j]);
            }
        }
        
        
        return wb;
    }
	
	
	
	public static HSSFWorkbook getGgflfwHSSFWorkbook(String sheetName,String []title,String [][]values, HSSFWorkbook wb){

		// 第一步，创建一个HSSFWorkbook，对应一个Excel文件
        if(wb == null){
            wb = new HSSFWorkbook();
        }
        //声明列对象
        HSSFCell cell = null;
        // 第二步，在workbook中添加一个sheet,对应Excel文件中的sheet
        HSSFSheet sheet = wb.createSheet(sheetName);
        sheet.autoSizeColumn(1, true);
        // 第三步，在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制
        HSSFRow row = sheet.createRow(0);

        // 第四步，创建单元格，并设置值表头 设置表头居中
        HSSFCellStyle style = wb.createCellStyle();
        style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
        style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
        
        
        HSSFCellStyle newStyle = wb.createCellStyle();
        newStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
        newStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
        newStyle.setRotation((short)255);
        
        
        CellRangeAddress callRangeAddress = new CellRangeAddress(0,0,0,47);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress);
        
        CellRangeAddress callRangeAddress1 = new CellRangeAddress(2,7,0,0);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress1);
        CellRangeAddress callRangeAddress2 = new CellRangeAddress(2,3,1,10);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress2);
        CellRangeAddress callRangeAddress3 = new CellRangeAddress(2,3,11,16);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress3);
        CellRangeAddress callRangeAddress4 = new CellRangeAddress(2,3,17,22);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress4);
        CellRangeAddress callRangeAddress5 = new CellRangeAddress(2,3,23,31);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress5);
        CellRangeAddress callRangeAddress6 = new CellRangeAddress(2,3,23,31);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress6);
        CellRangeAddress callRangeAddress7 = new CellRangeAddress(2,3,32,43);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress7);
        CellRangeAddress callRangeAddress8 = new CellRangeAddress(2,3,44,47);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress8);
        
        CellRangeAddress callRangeAddress9 = new CellRangeAddress(4,7,1,1);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress9);
        CellRangeAddress callRangeAddress10 = new CellRangeAddress(4,7,2,2);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress10);
        CellRangeAddress callRangeAddress11 = new CellRangeAddress(4,7,3,3);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress11);
        CellRangeAddress callRangeAddress12 = new CellRangeAddress(4,7,4,4);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress12);
        CellRangeAddress callRangeAddress13 = new CellRangeAddress(4,7,5,5);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress13);
        CellRangeAddress callRangeAddress14 = new CellRangeAddress(4,7,6,6);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress14);
        CellRangeAddress callRangeAddress15 = new CellRangeAddress(4,7,7,7);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress15);
        CellRangeAddress callRangeAddress16 = new CellRangeAddress(4,7,8,8);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress16);
        CellRangeAddress callRangeAddress17 = new CellRangeAddress(4,7,9,9);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress17);
        CellRangeAddress callRangeAddress18 = new CellRangeAddress(4,7,10,10);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress18);
        CellRangeAddress callRangeAddress19 = new CellRangeAddress(4,7,11,11);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress19);
        CellRangeAddress callRangeAddress20 = new CellRangeAddress(4,7,12,12);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress20);
        CellRangeAddress callRangeAddress21 = new CellRangeAddress(4,4,13,14);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress21);
        CellRangeAddress callRangeAddress22 = new CellRangeAddress(4,7,15,15);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress22);
        CellRangeAddress callRangeAddress23 = new CellRangeAddress(4,7,16,16);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress23);
        CellRangeAddress callRangeAddress24 = new CellRangeAddress(4,7,17,17);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress24);
        CellRangeAddress callRangeAddress25 = new CellRangeAddress(4,4,18,22);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress25);
        CellRangeAddress callRangeAddress26 = new CellRangeAddress(4,7,23,23);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress26);
        CellRangeAddress callRangeAddress27 = new CellRangeAddress(4,4,24,30);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress27);
        CellRangeAddress callRangeAddress28 = new CellRangeAddress(4,7,31,31);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress28);
        CellRangeAddress callRangeAddress29 = new CellRangeAddress(4,7,32,32);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress29);
        CellRangeAddress callRangeAddress30 = new CellRangeAddress(4,7,33,33);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress30);
        CellRangeAddress callRangeAddress31 = new CellRangeAddress(4,4,34,36);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress31);
        CellRangeAddress callRangeAddress32 = new CellRangeAddress(4,7,37,37);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress32);
        CellRangeAddress callRangeAddress33 = new CellRangeAddress(4,4,38,43);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress33);
        
        CellRangeAddress callRangeAddress34 = new CellRangeAddress(4,7,44,44);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress34);
        CellRangeAddress callRangeAddress35 = new CellRangeAddress(4,7,45,45);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress35);
        CellRangeAddress callRangeAddress36 = new CellRangeAddress(4,7,46,46);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress36);
        CellRangeAddress callRangeAddress37 = new CellRangeAddress(4,7,47,47);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress37);
        
        CellRangeAddress callRangeAddress38 = new CellRangeAddress(5,7,13,13);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress38);
        CellRangeAddress callRangeAddress39 = new CellRangeAddress(5,7,14,14);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress39);
        
        CellRangeAddress callRangeAddress40 = new CellRangeAddress(5,7,18,18);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress40);
        CellRangeAddress callRangeAddress41 = new CellRangeAddress(5,7,19,19);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress41);
        CellRangeAddress callRangeAddress42 = new CellRangeAddress(5,7,20,20);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress42);
        CellRangeAddress callRangeAddress43 = new CellRangeAddress(5,7,21,21);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress43);
        CellRangeAddress callRangeAddress44 = new CellRangeAddress(5,7,22,22);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress44);
        CellRangeAddress callRangeAddress441 = new CellRangeAddress(5,7,24,24);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress441);
        CellRangeAddress callRangeAddress45 = new CellRangeAddress(5,5,25,27);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress45);
        
        CellRangeAddress callRangeAddress451 = new CellRangeAddress(5,7,28,28);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress451);
        CellRangeAddress callRangeAddress452 = new CellRangeAddress(5,7,29,29);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress452);
        CellRangeAddress callRangeAddress453 = new CellRangeAddress(5,7,30,30);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress453);
        CellRangeAddress callRangeAddress454 = new CellRangeAddress(5,7,34,34);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress454);
        CellRangeAddress callRangeAddress455 = new CellRangeAddress(5,7,35,35);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress455);
        CellRangeAddress callRangeAddress456 = new CellRangeAddress(5,7,36,36);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress456);
        
        CellRangeAddress callRangeAddress457 = new CellRangeAddress(5,7,37,37);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress457);
        CellRangeAddress callRangeAddress458 = new CellRangeAddress(5,7,38,38);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress458);
        CellRangeAddress callRangeAddress459 = new CellRangeAddress(5,7,39,39);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress459);
        CellRangeAddress callRangeAddress460 = new CellRangeAddress(5,7,40,40);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress460);
        CellRangeAddress callRangeAddress461 = new CellRangeAddress(5,7,41,41);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress461);
        CellRangeAddress callRangeAddress462 = new CellRangeAddress(5,7,42,42);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress462);
        CellRangeAddress callRangeAddress463 = new CellRangeAddress(5,7,43,43);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress463);
        
        CellRangeAddress callRangeAddress46 = new CellRangeAddress(6,7,25,25);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress46);
        CellRangeAddress callRangeAddress47 = new CellRangeAddress(6,7,26,26);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress47);
        CellRangeAddress callRangeAddress48 = new CellRangeAddress(6,7,27,27);//起始行,结束行,起始列,结束列
        sheet.addMergedRegion(callRangeAddress48);
        
        
        
        
        
        
        cell = row.createCell(0);
        cell.setCellValue("律师业务统计表(公共法律服务)");
        cell.setCellStyle(style);
        row = sheet.createRow(1);
        for(int i=0;i<31;i++){
            cell = row.createCell(i);
            cell.setCellValue("");
            cell.setCellStyle(style);
        }

        row = sheet.createRow(2);
        cell = row.createCell(0);
        cell.setCellValue("分类");
        cell.setCellStyle(style);
        
        cell = row.createCell(1);
        cell.setCellValue("村（社区）法律顾问");
        cell.setCellStyle(style);
        
        cell = row.createCell(11);
        cell.setCellValue("信访法律事务");
        cell.setCellStyle(style);
        
        cell = row.createCell(17);
        cell.setCellValue("调解业务");
        cell.setCellStyle(style);
        cell = row.createCell(23);
        cell.setCellValue("法律援助案件");
        cell.setCellStyle(style);
        cell = row.createCell(32);
        cell.setCellValue("社会公益服务");
        cell.setCellStyle(style);
        cell = row.createCell(44);
        cell.setCellValue("参与城管执法");
        cell.setCellStyle(style);
        
        row = sheet.createRow(4);

        cell = row.createCell(1);
        cell.setCellValue("法律顾问总数");
        cell.setCellStyle(newStyle);
        cell = row.createCell(2);
        cell.setCellValue("担任法律顾问\r\n" + "的律师人数");
        cell.setCellStyle(newStyle);
        cell = row.createCell(3);
        cell.setCellValue("建立村社区法律顾问\r\n" + "微信群数");
        cell.setCellStyle(newStyle);
        cell = row.createCell(4);
        cell.setCellValue("提供法律咨询");
        cell.setCellStyle(newStyle);
        cell = row.createCell(5);
        cell.setCellValue("法治宣教和讲座");
        cell.setCellStyle(newStyle);
        cell = row.createCell(6);
        cell.setCellValue("村居务法律体检");
        cell.setCellStyle(newStyle);
        cell = row.createCell(7);
        cell.setCellValue("修订完善村规民约\r\n" + "合同协议");
        cell.setCellStyle(newStyle);
        cell = row.createCell(8);
        cell.setCellValue("提供法律援助");
        cell.setCellStyle(newStyle);
        cell = row.createCell(9);
        cell.setCellValue("调解矛盾纠纷");
        cell.setCellStyle(newStyle);
        cell = row.createCell(10);
        cell.setCellValue("其他事务");
        cell.setCellStyle(newStyle);
        cell = row.createCell(11);
        cell.setCellValue("参与信访接待处理\r\n" + "的律师数");
        cell.setCellStyle(newStyle);
        cell = row.createCell(12);
        cell.setCellValue("业务合计");
        cell.setCellStyle(newStyle);
        cell = row.createCell(13);
        cell.setCellValue("其中");
        cell.setCellStyle(style);
        cell = row.createCell(15);
        cell.setCellValue("随同党政领导接访人次");
        cell.setCellStyle(newStyle);
        cell = row.createCell(16);
        cell.setCellValue("信访值班人次");
        cell.setCellStyle(newStyle);
        cell = row.createCell(17);
        cell.setCellValue("合计");
        cell.setCellStyle(newStyle);
        cell = row.createCell(18);
        cell.setCellValue("其中");
        cell.setCellStyle(style);
        cell = row.createCell(23);
        cell.setCellValue("总计");
        cell.setCellStyle(newStyle);
        cell = row.createCell(24);
        cell.setCellValue("法律援助机构指派");
        cell.setCellStyle(style);
        cell = row.createCell(31);
        cell.setCellValue("律师事务所自主援助");
        cell.setCellStyle(newStyle);
        cell = row.createCell(32);
        cell.setCellValue("公益律师人数");
        cell.setCellStyle(newStyle);
        cell = row.createCell(33);
        cell.setCellValue("公益法律服务件数合计");
        cell.setCellStyle(newStyle);
        

        cell = row.createCell(34);
        cell.setCellValue("其中");
        cell.setCellStyle(style);

        cell = row.createCell(37);
        cell.setCellValue("捐款捐赠");
        cell.setCellStyle(newStyle);

        cell = row.createCell(38);
        cell.setCellValue("为社会弱势群体提供免费的法律服务数");
        cell.setCellStyle(style);
        cell = row.createCell(44);
        cell.setCellValue("参与城管执法工作的\r\n" + "律所数");
        cell.setCellStyle(newStyle);
        cell = row.createCell(45);
        cell.setCellValue("驻队律师人数");
        cell.setCellStyle(newStyle);
        cell = row.createCell(46);
        cell.setCellValue("落实工作经费");
        cell.setCellStyle(newStyle);
        cell = row.createCell(47);
        cell.setCellValue("提供城市管理法律服务\r\n" + "件数");
        cell.setCellStyle(newStyle);
        

        row = sheet.createRow(5);
        cell = row.createCell(13);
        cell.setCellValue("办理涉法信访案件");
        cell.setCellStyle(newStyle);
        cell = row.createCell(14);
        cell.setCellValue("参与信访接待");
        cell.setCellStyle(newStyle);
        cell = row.createCell(18);
        cell.setCellValue("法院律师调解室\r\n" + "调解案件");
        cell.setCellStyle(newStyle);
        cell = row.createCell(19);
        cell.setCellValue("公共法律服务中心\r\n" + "调解案件");
        cell.setCellStyle(newStyle);
        cell = row.createCell(20);
        cell.setCellValue("律师协会调解中心\r\n" + "调解案件");
        cell.setCellStyle(newStyle);
        cell = row.createCell(21);
        cell.setCellValue("律师事务所调解室\r\n" + "调解案件");
        cell.setCellStyle(newStyle);
        cell = row.createCell(22);
        cell.setCellValue("在线矛盾纠纷化解平台\r\n" + "调解案件");
        cell.setCellStyle(newStyle);
        cell = row.createCell(24);
        cell.setCellValue("刑事法律援助合计");
        cell.setCellStyle(newStyle);
        
        cell = row.createCell(25);
        cell.setCellValue("其 中");
        cell.setCellStyle(style);

        cell = row.createCell(28);
        cell.setCellValue("民事诉讼法律援助");
        cell.setCellStyle(newStyle);
        cell = row.createCell(29);
        cell.setCellValue("行政诉讼法律援助");
        cell.setCellStyle(newStyle);
        cell = row.createCell(30);
        cell.setCellValue("非诉讼法律援助");
        cell.setCellStyle(newStyle);

        cell = row.createCell(34);
        cell.setCellValue("法律咨询");
        cell.setCellStyle(newStyle);
        cell = row.createCell(35);
        cell.setCellValue("法治宣传讲座");
        cell.setCellStyle(newStyle);
        cell = row.createCell(36);
        cell.setCellValue("其他公益服务");
        cell.setCellStyle(newStyle);
        
        cell = row.createCell(38);
        cell.setCellValue("老年人");
        cell.setCellStyle(newStyle);
        cell = row.createCell(39);
        cell.setCellValue("妇女");
        cell.setCellStyle(newStyle);
        cell = row.createCell(40);
        cell.setCellValue("未成年人");
        cell.setCellStyle(newStyle);
        cell = row.createCell(41);
        cell.setCellValue("农名工");
        cell.setCellStyle(newStyle);
        cell = row.createCell(42);
        cell.setCellValue("残疾人");
        cell.setCellStyle(newStyle);
        cell = row.createCell(43);
        cell.setCellValue("其他");
        cell.setCellStyle(newStyle);
        

        row = sheet.createRow(6);
        cell = row.createCell(25);
        cell.setCellValue("依申请提供援助");
        cell.setCellStyle(newStyle);
        cell = row.createCell(26);
        cell.setCellValue("法定通知辩护");
        cell.setCellStyle(newStyle);
        cell = row.createCell(27);
        cell.setCellValue("扩大通知辩护");
        cell.setCellStyle(newStyle);

        row = sheet.createRow(8);
        //创建标题
        for(int i=0;i<title.length;i++){
            cell = row.createCell(i);
            String t="";
            if(i==0) {
            	t="甲";
            }else {
            	t=""+i;
            }
            cell.setCellValue(t);
            cell.setCellStyle(style);
        }

        //创建内容
        for(int i=0;i<values.length;i++){
        	
            row = sheet.createRow(i + 9);
            //row.createCell(0).setCellValue(s[i]);
            for(int j=0;j<values[i].length;j++){
                //将内容按顺序赋给对应的列对象
            	if(Strings.isNullOrEmpty(values[i][j])||values[i][j].equals("null")) {
            		continue;
            	}
                row.createCell(j).setCellValue(values[i][j]);
            }
        }
        
        
        return wb;
    }
	
	

}
